#ifndef SERIALPORTPROTOCOL_H
#define SERIALPORTPROTOCOL_H

#include <QObject>
class QByteArray;
class SerialPortProtocol : public QObject
{
    Q_OBJECT
public:
    explicit SerialPortProtocol(QObject *parent = nullptr);
    static SerialPortProtocol *getObject();




//     bool openClock();
//    bool closeClock();
//    bool requestCo2();


    bool requestTem(int boardId);
    bool requestHum1(int boardId);
    bool requestLight(int boardId);
    bool requestPress(int boardId);
    bool requestHum2(int boardId);

    bool openWater1(int boardId);
    bool closeWater1(int boardId);

    bool openWater2(int boardId);
    bool closeWater2(int boardId);




protected slots:
    /**
     * @brief serialPortReadDataSlot接收到数据的槽函数，信号由dirver类产生
     * @param data
     */
    void serialPortReadDataSlot(const QByteArray &data);

protected:
  void  handleFrame(const QByteArray &frame);
   static SerialPortProtocol *obj;
   QByteArray dataTemp;//用来接收缓存数据
   QByteArray temp;
signals:

void showRequestMessage(const QString &msg,const int &devicenum);

void showopenStatus(int boardId,int deviceId,int status);
//void newCo2(int co2);
public slots:
};

#endif // SERIALPORTPROTOCOL_H
